<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="v2/layout">
  <head>
    <title>欢迎进入管理系统</title>
    <script type="text/javascript" th:inline="javascript">
	    var serverH5Url = [[${application.serverH5Url}]];
    	var orgName = [[${session.user.name}]];
    	var state = getParam("state", "");
    	var evaluateId = getParam("evaluateId");
    	
    	var listDel = function(id, text, state){
      		$.jjconfirm({text:text+"？",yes:function(){
      			$.ajaxData({url:"notice-del",data:{id:id,state:state},type:"post",success:function(){
      				$("#listPage").pageReload();
      	  		}});
      		}});
      	}
    	
    	var clipboard = function(id){
    		$.jjalert({title:"请复制下面链接",text:serverH5Url+"/blogs/special/"+id});
    	}
    	
    	$(function(){
    		setMenu("外链", true);
    		
    		$("#listPage").page({url:"notice-list",data:{type:"NEW"}, success:function(ret){
      			$.each(ret.obj.content, function(i,v){
        			v.createdAt = new Date(v.createdAt).Format("yyyy-MM-dd HH:mm");
        					
        		});
      			$("#list").loadData({content:ret.obj.content,orgName:orgName});
      		}});
    	});
    </script>
    <style>
    </style>
  </head>
  <body>
    <div layout:fragment="content">
		<div class="info info-full">
				<div class="detail-table">
					
       				<h4 class="detail-table-title">
						外链
						<button class="list-btn-item" style="float: right;" onclick="location.href='notice-detail?type=NEW'">新建外链</button>
					</h4>
				    <div class="table_list">
		               <div class="table-overflow">
		                   <table class="table">
		                       <thead>
			                       <tr>
			                       	 <th>封面</th>
	                                 <th width="60">关联比赛</th>
	                                 <th width="100">操作</th>
			                       </tr>
		                       </thead>
		                       <tbody>
		                       	<script type="text/template" id="list">
								#for(data:content)#
		                       	<tr>
									<td>
										<div class="article">
		                       				<img src="#{data.pic}#" class="article-cover"/>
		                       				<div class="article-info">
		                       					<div class="article-title">#{data.title}#</div>
		                       					<div class="article-time">
		                       						<span class="article-time-text">#{data.createdAt}#</span>
		                       					</div>
		                       				</div>
		                       			</div>
									</td>
		                       		<td>
										#if(data.evaluateList.length!=0)#
		                       			<div class="link">
		                       				#{data.evaluateList.length}#
											<div class="link-more">
											#for(e:data.evaluateList)#
		                       					<div class="link-more-item">
			                       					<div class="article">
					                       				<img src="#{e.coverUrl}#" class="article-cover"/>
					                       				<div class="article-info">
					                       					<div class="article-title" style="height: 72px;"><a href="/v2/evaluate/list-detail?id=#{e.id}#" >#{e.title}#</a></div>
					                       					<div class="article-time">
					                       					</div>
					                       				</div>
					                       			</div>
				                       			</div>
											#endfor#
											</div>
		                       			</div>
										#endif#
		                       		</td>
		                       		<td>
		                       			<div class="button">
		                       				<div class="button-item"><a href="notice-detail?id=#{data.id}#">编辑</a></div>
		                       				<div class="button-item">
												#if(data.state=='LIVE')# <a href="javascript:listDel(#{data.id}#, '下架', 'DIE')">下架</a> #endif#
												#if(data.state=='DIE')# <a href="javascript:listDel(#{data.id}#, '上架', 'LIVE')">上架</a> #endif#
											</div>
		                       			</div>
		                       		</td>
		                       	</tr>
								#endfor#
								</script>
		                     </tbody>
		                 </table>
		                 <div id="listPage"></div>
		             </div>
		          </div>
	          </div>
			
    	</div>
    	
    </div>
  </body>
</html>